package main

import "strings"

func calculate(s string) int {
	s = strings.ReplaceAll(s, " ", "")
	var numbers []int
	current := 0
	var lastSign byte = '+'
	for i := 0; i < len(s); i++ {
		c := s[i]
		if c == ' ' {
			continue
		}
		if c >= '0' && c <= '9' {
			current = current*10 + int(c-'0')
		}
		if i == len(s)-1 || !(c >= '0' && c <= '9') {
			if lastSign == '+' {
				numbers = append(numbers, current)
			} else if lastSign == '-' {
				numbers = append(numbers, -current)
			} else if lastSign == '*' {
				numbers[len(numbers)-1] *= current
			} else if lastSign == '/' {
				numbers[len(numbers)-1] /= current
			}
			current = 0
			lastSign = c
		}
	}
	result := 0
	for _, val := range numbers {
		result += val
	}
	return result
}

func main() {
	res := calculate(" 3/2 ")
	println(res)
}